from django import template


register = template.Library()


@register.inclusion_tag('title.html')
def title(request, display=None, city=None):
    name = request.session.get('name')
    if city:
        return {'name': name, 'display': '返回搜索页面', 'detail': '返回展示页面', 'city': city}
    if not city and display:
        return {'name': name, 'display': '返回搜索页面'}
    else:
        return {'name': name}